Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

180
Visualizações
window.addEventListener("message", getData); doesn't work in safari?

I am sending a postmessage from js script to iframe which is in react

// listensting to postMessage() function in react // React File

useEffect(() => {

function getData(e) {
  console.log("inside function");
  var origin = e.origin || e.originalEvent.origin;
  console.log("origin", origin);

  if (typeof e.data == "object" && "shopDomain" in e.data) {
    console.log(e.data);
  } else {
    console.log("not able to catch data");
  }
}
window.addEventListener("message", getData, false);
return () => {
  window.removeEventListener("message", getData, false);
};
}, []);

// JS File

let win = iframe.contentWindow;
win.contentWindow.postMessage(
  {
    customerId: customerId_rs,
    parentLocation: window.location.host,
  },
  "*"
);

Looked at various sites but can't find any solution. Have spent almost 10 hours at this any help would be appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

it seems like safari dont have the full support but it should support if you check the browser support of addEventListener you can see

  • options.passive parameter defaults to true for touchstart and touchmove events
  • options.passive parameter defaults to true for wheel and mousewheel events
  • options.signal parameter

these do not have support. you can read more about it here

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda